﻿using ProtoBuf;

namespace Mohe.Scada.Util.Models
{
    public class RemoteTelemetryData
    {
        public DateTime TimeStamp { get; set; } = DateTime.Now;

        public Dictionary<string, object> Data { get; set; } = new();
    }
    public struct TcpHeader
    {
        /// <summary>
        /// 功能号
        /// </summary>
        public int FunctionId { get; set; }
        /// <summary>
        /// 包长
        /// </summary>
        public int ZipLen { get; set; }
        /// <summary>
        /// 原始包长
        /// </summary>
        public int UnZipLen { get; set; }

    }

    [ProtoContract]
    public class SendModel
    {
        [ProtoMember(1)]
        public List<PayLoadItem> Items { get; set; }
        [ProtoMember(2)]
        public DateTime UpdateTime { get; set; }

        [ProtoMember(3)]
        public EnumDeviceStatus DeviceStatus { get; set; }

        [ProtoMember(4)]
        public int DeviceId { get; set; }
    }
    [ProtoContract]
    public class PayLoadItem
    {
        [ProtoMember(1)]
        public string Key { get; set; }
        [ProtoMember(2)]
        public string Value { get; set; }
        [ProtoMember(3)]
        public EnumVariableStatus VariableStatus { get; set; }
    }

    [ProtoContract]
    public class FaultList
    {
        [ProtoMember(1)]
        public List<FaultItem> FaultItems { get; set; }
    }

    [ProtoContract]
    public class FaultItem
    {
        [ProtoMember(1)]
        public long Id { get; set; }

        /// <summary>
        /// 变量类型
        /// </summary>
        [ProtoMember(2)]
        public short WarningType { get; set; }
        /// <summary>
        /// 变量ID
        /// </summary>
        [ProtoMember(3)]
        public int VarId { get; set; }
        /// <summary>
        /// 报警内容
        /// </summary>
        [ProtoMember(4)]
        public string WarningContent { get; set; } = string.Empty;
        /// <summary>
        /// 发生时间
        /// </summary>
        [ProtoMember(5)]
        public DateTime RecordTime { get; set; }
        /// <summary>
        /// 确认时间
        /// </summary>
        [ProtoMember(6)]
        public DateTime? ConfirmTime { get; set; }
        /// <summary>
        /// 已确认
        /// </summary>
        [ProtoMember(7)]
        public bool Confirmed { get; set; }
        /// <summary>
        /// 解决时间
        /// </summary>
        [ProtoMember(8)]
        public DateTime? SolveTime { get; set; }
        /// <summary>
        /// 解决标志
        /// </summary>
        [ProtoMember(9)]
        public bool Solved { get; set; }
    }
}
